<?php

namespace App\Modules\Apicrzs\Http\Controllers;

use App\Modules\Admin\Http\Requests\Article\ArticleRequest;
use App\Modules\Apicrzs\Http\Requests\UserBankRequest;
use App\Modules\Apicrzs\Services\UserBankService;
use Illuminate\Http\JsonResponse;
use Illuminate\Http\Request;

class UserBankController extends BaseApicrzsController
{


    public function __construct(UserBankService $authService)
    {
        $this->service = $authService;
    }

    public function lists(Request $request): JsonResponse
    {
        $params = $request->all();
        $result = $this->service->getLists($params);
        return $this->sendApiSuccess($result, $this->service->getError());
    }
    public function create(UserBankRequest $request): JsonResponse
    {
        return $this->createService($request);
    }

    public function update(UserBankRequest $request): JsonResponse
    {
        return $this->updateService($request);
    }
    public function detail(Request $request): JsonResponse
    {
        if ($result = $this->service->detail($request)) {
            return $this->sendApiSuccess($result, $this->service->getError());
        }else{
            return $this->sendApiError($this->service->getError());
        }
    }
    public function getUserBankLists(Request $request): JsonResponse
    {
        $params = $request->all();
        if ($result = $this->service->getUserBankLists($params)) {
            return $this->sendApiSuccess($result, $this->service->getError());
        }else{
            return $this->sendApiError($this->service->getError());
        }
    }


}
